/*
 * @(#)RepositoryRequest.java
 * Date 2013-10-21
 * Version 1.0
 * Author Jim Horner
 * Copyright (c)2012
 */


package us.hornerscorners.lamppost.xca.model;

import java.util.ArrayList;
import java.util.List;

import ihe.iti.xds_b._2007.RetrieveDocumentSetRequestType;

import ihe.iti.xds_b._2007.RetrieveDocumentSetRequestType.DocumentRequest;

import us.hornerscorners.lamppost.repository.client.IRepositoryClient;


/**
 * Class description
 *
 *
 * @version        v1.0, 2013-10-21
 * @author         Jim Horner
 */
public class RepositoryRequest {

    /** Field description */
    private final List<DocumentRequest> documentRequests;

    /** Field description */
    private final IRepositoryClient repositoryClient;

    /**
     * Constructs ...
     *
     *
     * @param client
     */
    public RepositoryRequest(IRepositoryClient client) {

        super();
        this.repositoryClient = client;
        this.documentRequests = new ArrayList<>();
    }

    /**
     * Method description
     *
     *
     * @param request
     */
    public void add(DocumentRequest request) {

        this.documentRequests.add(request);
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public RetrieveDocumentSetRequestType buildRequest() {

        RetrieveDocumentSetRequestType result = new RetrieveDocumentSetRequestType();

        result.getDocumentRequest().addAll(this.documentRequests);

        return result;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public IRepositoryClient getRepositoryClient() {

        return repositoryClient;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public boolean hasDocumentReqeusts() {

        return (this.documentRequests.isEmpty() == false);
    }
}
